import os
import requests
import json
import test_util

from dotenv import load_dotenv

load_dotenv()  # take environment variables from .env.

JOB_API_URL = os.environ.get('JOB_API_URL')
print('JOB_API_URL: %s' % JOB_API_URL)

def test_trace_order_status():
    print('>> test_trace_order_status')
    url = 'http://192.168.56.101:8090/job/callApi'
    jobParam = {
        "version": "1.0",
        "module": "profit",
        "name": "batch_process_profit_task",
        "args": [],
        "kwargs": {},
        "remark": "分润批处理测试"
    }
    payload = {
        "apiName": "runJob",
        "jobId": 7,
        "delayMS": 3000,
        "jobParam": json.dumps(jobParam)
    }
    resp = test_util.post_service_api(url, payload=payload)
    print('resp: %s' % resp)

def test_batch_profit_process():
    print('>> test_batch_profit_process')
    url = 'http://192.168.56.101:8090/job/callApi'
    jobParam = {
        "version": "1.0",
        "module": "profit",
        "name": "batch_process_profit_task",
        "args": [],
        "kwargs": {},
        "remark": "分润批处理测试"
    }
    payload = {
        "apiName": "runJob",
        "jobId": 7,
        "delayMS": 3000,
        "jobParam": json.dumps(jobParam)
    }
    resp = test_util.post_service_api(url, payload=payload)
    print('resp: %s' % resp)


if __name__ == '__main__':
    #test_batch_profit_process()
    pass

